class Position {

    static belongsTo = [ event: Event ]
    static hasMany = [ registrations: PositionRegistration ]

    String name
    String location
    String description
    int requiredVolunteers
    Date startDate
    Date endDate

    int totalnoofPositions
    int noOfVolunteerOpenPosition



    static constraints = {
        name(nullable: false, blank: false)
        description(nullable: false, size:0..50, blank: false)
        location(nullable: false, size:0..20, blank: false)
        requiredVolunteers(nullable: false, blank: false)    
        event(nullable: false)
       startDate()
     endDate(validator:{val, obj->
     return val.after(obj.startDate)
     })
    }
    static mapping = {
        table("event_position")
    }
}